import java.util.Scanner;

public class HomeWork13_08{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        System.out.print("please enter student id: ");
        String id = scan.next();
        
        if(ShxtStu.check(id)){
            System.out.println("合法");
        }else{
            System.out.println("不合法");
        }
    }
}

class ShxtStu{
    public static boolean check(String id){
        String stuRegexp = "shxt_(0[7-9]|1[0-6])\\d\\d";
        if(id.matches(stuRegexp)){
            return true;
        }
        return false;
    } 
}